<?php require_once("includes/security.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>קליניקה נטורופתית</title>
<script language="JavaScript" type="text/javascript" src="Script/jquery-1.9.1.js"></script>
<?php 		
require_once("includes/initializeSession.php");
require("includes/openConnection.php");

if(isset($_POST['submit'])) 
	{
		
				if(mysql_query("INSERT INTO privatemsg (`id`, `from_2`, `to_2`, `msg`) VALUES (NULL, '{$_SESSION['UserName']}', 'admin', '{$_POST['msg']}');"))
				echo "הודעה פרטית נשלחה בהצלחה";
				else
				echo "הודעה פרטית לא נשלחה בהצלחה";
}//end submit
	

?>
<script language=javascript>
var aaa=self.setInterval(function(){readMyChat()},500);
function readMyChat() {
 	$.ajax({ url: 'includes/functions.php',
    data: {func: 'readMyChat'},
    type: 'post',
    success: function(output) 
		{
		
		$("#chat").html(output);
		}
	});	
}
</script>
</head>

<body>
<container id="container">
  <?php require("header.php"); ?>
      <content id="content">
      <contentTitle id="contentTitle">
      התקשרות אישית עם מנהלת הקליניקה
      </contentTitle>
      <contentText id="contentText">
    			
<form name="form" action="#" method="post" enctype="multipart/form-data">
<table >
            <td>
           הודעה:
            </td>
            <td >
             <input type="text"  id="msg" name="msg" value="" size="30" >
            <td>
   		</tr>
        <tr>
            <td>
            <input type="submit" name="submit" value="שלח" /> 
            </td>
    	</tr>
</table>
</form>
    
 <subContentTitle id="subContentTitle">הודעות</subContentTitle>	
 <table id="chat" >

</table>   
</contentText>
      </content>
</container>
    
     
    
</body>
</html>
